#ifndef __MIN_KERNEL_GATE__
#define __MIN_KERNEL_GATE__

#include <windows.h>
#include <winnt.h>
#include "winxdef.h"

//////////////////////////////////////////////////////////////////////////
//
// Heap
//
HANDLE	WINAPI	McCreateHeap( ULONG flags, PVOID addr, SIZE_T totalSize, SIZE_T commitSize );
BOOLEAN WINAPI	McValidateHeap( HANDLE heap, ULONG flags, LPCVOID ptr );
HANDLE	WINAPI	McDestroyHeap( HANDLE heap );
PVOID	WINAPI	McAllocateHeap( HANDLE heap, ULONG flags, SIZE_T size );
BOOLEAN	WINAPI	McFreeHeap( HANDLE heap, ULONG flags, PVOID ptr );
PVOID	WINAPI	McReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, SIZE_T size );
ULONG	WINAPI	McCompactHeap( HANDLE heap, ULONG flags );
BOOLEAN WINAPI	McLockHeap( HANDLE heap );
BOOLEAN WINAPI	McUnlockHeap( HANDLE heap );
SIZE_T	WINAPI	McSizeHeap( HANDLE heap, ULONG flags, const void *ptr );
BOOLEAN WINAPI	McValidateHeap( HANDLE heap, ULONG flags, LPCVOID ptr );
ULONG	WINAPI	McGetProcessHeaps( ULONG count, HANDLE *heaps );
HANDLE	WINAPI	McGetProcessHeap();
PVOID	WINAPI	McProcessHeapAlloc( ULONG flags, SIZE_T cbData );
HRESULT	WINAPI	McLdrInitOrInsertModule( PEB * lpPEB, LDR_MODULE * lpMod, LDR_MODULE * PrevMod );
HRESULT	WINAPI	McModuleStartup( char* DllBase, IMAGE_TLS_DIRECTORY dir, SIZE_T entry );
HRESULT	WINAPI	McDispatchException( TEB * teb, SIZE_T expCode, SIZE_T flags, SIZE_T argc, SIZE_T * args );
//////////////////////////////////////////////////////////////////////////
HRESULT	WINAPI	McLdrpCallTlsInitializers( HMODULE hModule, ULONG Reason, IMAGE_TLS_DIRECTORY * lpTlsDirectory );


//////////////////////////////////////////////////////////////////////////
//
//	Privates
//
typedef PIMAGE_TLS_CALLBACK		PDLL_INIT_ROUTINE;
HRESULT WINAPI __McLdrpCallInitRoutine( PDLL_INIT_ROUTINE fn, PVOID hModude, ULONG Reason, ULONG Reversed );

#endif

